package com.xinjiang.electricpower.timer;

import com.xinjiang.electricpower.service.IMarketPullDataTask;
import com.xinjiang.electricpower.service.IServicePullDataTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.Duration;
import java.time.Instant;

/**
 * @author zhanghui
 * @date 2023/2/16 13:33
 * @Description
 */
@Service
@Slf4j
public class ServicePullDataTask implements IServicePullDataTask {

    @Autowired
    private IMarketPullDataTask iMarketPullDataTask;

    @Override
    public void runServiceTaskParam(String startDate, String endDate) {
        Instant start = Instant.now();
        log.info("拉取{}工单数据开始：{}",KettleQuartz.GD_FW, start);
        //执行拉取营销数据对应的ktr
        iMarketPullDataTask.runTaskParam(startDate,endDate,KettleQuartz.GD_FW,"kettle/kettle.ktr");
        Instant end = Instant.now();
        log.info("拉取{}工单数据结束：{}",KettleQuartz.GD_FW, end);
        log.info("拉取{}工单数据，耗时：{} 毫秒",KettleQuartz.GD_FW, Duration.between(start,end).toMillis());

    }
}
